package com.kaishengit.action;





import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.kaishengit.pojo.User;
import com.kaishengit.service.LoginService;




public class IndexAction implements SessionAware {
	
	private Map<String,Object> session;
	
	 private User user;
	 private LoginService loginService;
	
	public String execute(){
		return "success";
	}
	
	




		public String login(){
		
		User user1=loginService.login(user);
		
		if(user1!=null){
			System.out.println(user1.getUsername());
				session.put("user",user1);
					return "success";
				}
				return "login";
		}
	
		
		public LoginService getLoginService() {
			return loginService;
		}
		
		
		
		
		
		public void setLoginService(LoginService loginService) {
			this.loginService = loginService;
		}
		
	
	
	
	
	public User getUser() {
			return user;
		}
		public void setUser(User user) {
			this.user = user;
		}



		public void setSession(Map<String, Object> session) {
			this.session = session;
		}

}
